package com.aishua.aishuawallet.fregment;

import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.aishua.aishuawallet.R;
import com.aishua.aishuawallet.adapter.FindAdapter;
import com.aishua.aishuawallet.adapter.ManagerAdapter;
import com.aishua.aishuawallet.adapter.MyItemDecoration;
import com.aishua.aishuawallet.adapter.RecycleViewDivider;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by aishua on 2018/7/31.
 */

public class ThreeFregment extends BaseFragment {

    private Context mContext;
    private RecyclerView rl_find;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);

        mContext = getContext();
        View view = View.inflate(mContext, R.layout.fregment_three, null);

        initVeiw(view);
        return view;

    }

    private void initVeiw(View view) {

        rl_find = view.findViewById(R.id.rl_find);
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());

        rl_find.setLayoutManager(layoutManager);
//        rl_account.setItemAnimator(new DefaultItemAnimator());
        rl_find.addItemDecoration(new RecycleViewDivider(getContext(), LinearLayoutManager.HORIZONTAL, 2, Color.GRAY));
        List list = new ArrayList();
        for (int i = 0; i < 9; i++) {

            list.add("1");

        }

        FindAdapter managerAdapter = new FindAdapter(mContext, (ArrayList) list);
        rl_find.setAdapter(managerAdapter);
        managerAdapter.setonRecycleViewClickListener(new FindAdapter.onRecycleViewClickListener() {
            @Override
            public void onRecycleViewClick(int position) {

                Toast.makeText(mContext, getResources().getString(R.string.developing), Toast.LENGTH_SHORT).show();
            }
        });
    }


}